package com.xh.shuati.ai.model;

import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "langchain4j.community.dashscope.streaming-vl-model")
@Data
public class QwenStreamingVisualChatModelConfig {

    private String modelName;

    private String apiKey;

    /**
     * OpenAI SDK 方式配置vlchatmodel
     * @return
     */
    @Bean
    public StreamingChatLanguageModel myQwenStreamingVLChatModel() {
        return OpenAiStreamingChatModel.builder()
                .apiKey(apiKey)
                .modelName(modelName)
                //添加监听器
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .build();
    }
}
